/*
   file : client.c
   University of Jiangsu
   memoryDB      2010.6
 */


#include"api.h"

int main()
{
	int sockfd=sql_connect(IP_ADD,PORT);
	if(sockfd < 0){
		printf("connect error\n");
		return 0;
	}

	char send[MAX_COMMAND];
	printf("########## welcome to ABC-DB system ##############\n");
	printf("########## type \"help;\" for help #################\n");
	
	while(1){
		bzero(send,MAX_COMMAND);
		printf("$:");
		fgets(send,MAX_COMMAND,stdin);

		if(send[strlen(send)-2]!=';')
		  continue;

		send[strlen(send)-1]=0;

		if(sql_exec(send,strlen(send),sockfd) == -2)
			break;
	}
}
